﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//using System.Web.Mvc;
//using DAO;
//using System.Web.Routing;

//namespace WebUI.Controllers
//{
//    public class NavController : Controller
//    {
//        private DaoRepository dao;
//        public NavController()
//        {
//            this.dao = new DaoRepository();
//        }

//        public ActionResult Menu(string highlightCategory)
//        {
//            List<NavLink> navLinks = new List<NavLink>();
//            navLinks.Add(new CategoryLink(null) { IsSelected = (highlightCategory == null)});
//            var categories = dao.CategoryRepository.GetAll();//.Select(x => x.Category);
//            foreach (string category in categories.Distinct().OrderBy(x => x))
//                navLinks.Add(new CategoryLink(category) { IsSelected = (category == highlightCategory)});
//            return PartialView("Menu", navLinks);
//        }
//    }

//    public class NavLink
//    {
//        public string Text { get; set; }
//        public RouteValueDictionary RouteValues { get; set; }
//        public bool IsSelected { get; set; }
//    }

//    public class CategoryLink : NavLink
//    {
//        public CategoryLink(string category)
//        {
//            Text = category ?? "Home";
//            RouteValues = new RouteValueDictionary(new { 
//            controller = "Products", action = "List",
//            category = category, page = 1});
//        }
//    }
//}
